import setFilter from "@/store/http/setFilter";
export default {
	namespaced: true,
	state: {
		tabOn: 0,
		filterTabList: [{}],
		matchFiltersList: [],
		currentNodeKey: "",
	},
	getters: {
		relChain(state) {
			const { filterTabList, tabOn } = state;
			return filterTabList[tabOn];
		},
	},
	mutations: {
		merge(state, payload) {
			Object.assign(state, payload);
		},
	},
	actions: {
		//获取tab
		async queryTab({ commit, state, rootGetters, rootState, dispatch }, send) {
			const params = {
				...send,
				operate: "filterTypes",
			};

			const { result, data } = await setFilter.getDetailShow(params);
			if (result == "success") {
				commit("merge", {
					filterTabList: data.filterTabList || [],
				});
			}
		},
	},
};
